package com.example.dell.test1;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * Created by Dell on 2016/6/2.
 */
public class AppActivity extends Activity {
    Button kuaidi,taobao,zixun,music;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_app);
        /*定义四个按钮*/
        kuaidi = (Button)findViewById(R.id.kuaidi);
        taobao = (Button)findViewById(R.id.taobao);
        zixun = (Button)findViewById(R.id.zixun);
        music = (Button)findViewById(R.id.music);

        /**
         * 快递按钮点击
         */
        kuaidi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("http://m.kuaidi100.com/");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);//跳转到页面
                startActivity(intent);
            }
        });

        /**
         * 淘宝按钮点击
         */
        taobao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("https://ai.m.taobao.com/index.html?pid=mm_69820986_13152512_52722517");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });

        /**
         * 咨询按钮点击
         */
        zixun.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("http://i.ifeng.com/?ch=ifengweb_2014");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });

        /**
         * 音乐按钮点击
         */
        music.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("http://m.xiami.com/");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });
    }
}
